import { TableColumnObject } from 'amis/lib/renderers/Table'
import serverColumnUtils, { ServerColumnUtilsProps } from '@/components/amis/ServerColumnUtils/serverColumnUtils'
import iamAccountProfileService from '@/core/account/service/iamAccountProfileService'
import iamAccountProfileAdminService from '@/core/account/generated/service/admin/iamAccountProfileAdminService'

class IamAccountIdForProfileColumnUtils {
	getSchema = (parmas?: Partial<ServerColumnUtilsProps>): TableColumnObject => {
		const mergeSchema = Object.assign(
			{
				name: 'iamAccountId',
				label: '账户',
				valueField: 'id',
				labelField: 'nickName',
				getByIdsWithDebounce: iamAccountProfileAdminService.getByIdsWithDebounce,
			},
			parmas,
		) as ServerColumnUtilsProps
		const schema = serverColumnUtils.getSchema(mergeSchema)
		return schema as TableColumnObject
	}
}

export default new IamAccountIdForProfileColumnUtils()
